const https = require('https');
const cheerio = require('cheerio')
// 发送get请求，请求网页html文件

https.get('https://www.tupianzj.com/meinv/mm/dabomeinv/', (res) => {
  res.setEncoding('utf8');
  let str = '';
  let i = 0;
  const imgArr = []
  res.on('data', (chunk) => {
   str+=chunk;
  });
  res.on('end', () => {
    const $ = cheerio.load(str);
    $('img').each((i, el) => {
      // console.log($(el).attr('src'))
      imgArr.push($(el).attr('src'))
    })
    console.log(imgArr);
  });
}).on('error', (e) => {
  console.error(`Got error: ${e.message}`);
});
